//
//  KUploadImageRequest.m
//  Peanut
//
//  Created by Jim huang on 2018/4/2.
//  Copyright © 2018年 Jim_Peanut. All rights reserved.
//

#import "KUploadImageRequest.h"
#import "KUserInfoAPI.h"

@implementation KUploadImageRequest

//上传图片
-(instancetype)initWithUploadImage:(UIImage *)image{
    
    if (self = [super initPOSTWithRequestUrl:KUploadImageURL]) {
        
        //将图片转为data数据
        NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
        
        //将数据转为base64字符串
        NSString *imageDataStr = [imageData base64EncodedString];

        [self.paramsDic setValue:imageDataStr forKey:@"image"];
        [self.paramsDic setValue:@"png" forKey:@"suffix"];
    }
    
    return self;
    
}


@end
